package com.woniuxy.controller;

import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/menu")
@Api(tags = "菜单接口")
public class MenuController {
    @Autowired(required = false)
    MenuService menuService;

    @GetMapping("/all")
    @ApiOperation(value = "获取所有菜单数据")
    public ResponseEntity findAll(){
        return menuService.findAll();
    }

    @GetMapping("/findByRoleId/{roleId}")
    @ApiOperation(value = "根据roleid查询菜单")
    public ResponseEntity findByRoleId(@ApiParam(name = "角色id", value="roleId")@PathVariable int roleId){
        return   menuService.findByRoleId(roleId);
    }
}
